Regular expression matching allows patterns of characters, words, text, and/or symbols to be matched with input strings or streams. Typically, a regular expression (a.k.a. regex or regexp) is specified in a formal language that provides a flexible means for expressing the patterns to be matched. An example of a regular expression matching language is specified by the IEEE POSIX Basic Regular Expression standard.
One of the uses of regular expression matching is for Deep Packet Inspection (DPI). In DPI, a packet traversing a network may be searched by a piece of network equipment against a database of regular expressions for protocol non-compliance, viruses, SPAM, intrusions, other predefined criteria, or to collect statistical information. If a search turns up a successful match, further actions may be taken on the packet. DPI may be used by enterprises, service providers and governments for a wide range of applications